﻿//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Logging Application Block
//===============================================================================

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Microsoft.Practices.EnterpriseLibrary.Configuration.Design;
using Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.Design;
using Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.Design.Formatters;
using EntLibContrib.Logging.Configuration.Design.Formatters;
using EntLibContrib.Logging.Properties;

namespace EntLibContrib.Logging.Configuration.Design
{
	/// <summary>
	/// Logging Block command register
	/// </summary>
	sealed class LoggingCommandRegistrar : CommandRegistrar
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="LoggingCommandRegistrar"/> class.
		/// </summary>
		/// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param>
		public LoggingCommandRegistrar(IServiceProvider serviceProvider)
			: base(serviceProvider)
		{
		}

		/// <summary>
		/// Register the commands.
		/// </summary>
		public override void Register()
		{
			AddTemplateTextFormatterCommand();
			AddDefaultCommands(typeof(TemplateTextFormatterNode));
		}

		/// <summary>
		/// Adds the template text formatter command.
		/// </summary>
		private void AddTemplateTextFormatterCommand()
		{
			AddMultipleChildNodeCommand(InternalResources.TemplateTextFormatterUICommandText,
				InternalResources.TemplateTextFormatterUICommandLongText,
				typeof(TemplateTextFormatterNode),
				typeof(FormatterCollectionNode));
		}
	}
}
